package org.hs.phd.odi.tracking.tracker.trackwindow;

import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Float;

import org.hs.phd.odi.tracking.tracker.TrackWindow;

public abstract class AbstractRegularGridTrackWindow implements TrackWindow {
	
	@Override
	public final Float getGridCenter() {
		Point2D.Float center = getCenter();
		return new Point2D.Float( (float) (center.x - 0.5F), (float) (center.y - 0.5F));
	}

	@Override
	public final float distanceFromCenterTo(float x, float y) {
		Point2D.Float center = getCenter();
		float dx = x - center.x;
		float dy = y - center.y;
		return (float)Math.sqrt(dx*dx + dy*dy);
	}


}
